<!DOCTYPE html>
<html>
  <head>
    <title><%= yield(:title) %></title>
    <%= favicon_link_tag image_path("favicon.ico") %>
    <%= csrf_meta_tags %>
    <%= csp_meta_tag %>

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    <script type="text/javascript" src="<%= asset_path("/js/ckeditor.js", skip_pipeline: true) %>"></script>
  </head>

  <body class="<%= controller.controller_name %>">
    <%= render "layouts/header" %>
    <!--主要内容-->
    <div class="container">
      <% flash.each do |message_type, message | %>
        <div class="alert alert-<%= message_type %>"><%= message %></div>
      <% end %>
      <%= yield %>
    </div>
    <%= render "layouts/footer" %>

    <script type="text/javascript" charset="utf-8">
        document.addEventListener('turbolinks:load', () => {
            ClassicEditor.create(document.querySelector('.ckeditor'), {
                simpleUpload: { uploadUrl: '/uploads' },
            })
        })
    </script>
  </body>
</html>
